function formInit() {
    var validateFrom = $('#materialForm');
    validateFrom.validate({
        rules: {
            name: {
                required: true,
                'isName': true,
                rangelength: [2, 5]


            },
            tel: {
                required: true,
                'isMobile': true,
            },
            email:{
                required: true,
                email:true,
            },
            addr: 'required',
            id:{
                required:true,
                'isID':true
            },
            money:{
                number:true,
                require:true
            }

        },
        messages: {
            name: {
                required: '请输入姓名',
                'isName': '名字只能是汉字',
                rangelength: '名字长度不正确'

            },
            tel: {
                'required': "请输入联系电话",
                'isMobile': "电话格式不正确"
            },
            addr: '请输入地址',
            email:{
                required:'请输入email地址',
                email:'请输入正确的email地址'
            },
            id:{
                required:'请输入身份证号码',
                'isID':'请输入正确身份证号码',
            },
            money:{
                number:'必须为数字',
                require:'请输入金额'
            }


        }
    });

    jQuery.validator.addMethod("isMobile", function (value, element) {
        var reg = /^1[3578]\d{9}$/;
        return this.optional(element) || (reg.test(value));
    }, "手机格式不正确");

    jQuery.validator.addMethod("isName", function (value, element) {
        //var reg = /(.+)?\d(.+)?/;
        //return this.optional(element) || (!reg.test(value));
        var reg =/^[\u2E80-\u9FFF]+$/;
        return this.optional(element) || (reg.test(value));
    }, "姓名只能是汉字");
    jQuery.validator.addMethod("isID", function (value, element) {
        var reg =  /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/;
        return this.optional(element) || (reg.test(value));
    }, "身份证格式不正确");


}
$(function () {
    formInit();

});